<template>
  <div>
    <div class="banner" @click="handlerClick">
      <img class="banner-img"
           :src="bannerImg"
           alt="">
      <div class="banner-info">
        <div class="banner-title">{{sightName}}</div>
        <div class="banner-number">39</div>
      </div>
    </div>
    <!--fade-animation 动画组件-->
    <fade-animation>
      <common-gallary
        :imgs="gallaryImgs"
        v-show="showGallary"
        @close="handleGallaryClick">
      </common-gallary>
    </fade-animation>
  </div>
</template>

<script>
  import CommonGallary from 'common/gallary/Gallary'
  import FadeAnimation from 'common/fade/Fade'

  export default {
    name: 'Banner',
    props: {
      sightName: String,
      bannerImg: String,
      gallaryImgs: Array
    },
    data () {
      return {
        showGallary: false,
        imgs: ['http://img1.qunarzz.com/sight/p0/201404/23/04b92c99462687fa1ba45c1b5ba4ad77.jpg_600x330_bf9c4904.jpg',
          'http://img1.qunarzz.com/sight/p0/201404/23/04b92c99462687fa1ba45c1b5ba4ad77.jpg_600x330_bf9c4904.jpg']

      }
    },
    components: {
      CommonGallary, FadeAnimation
    },
    methods: {
      //控制图片画廊显示
      handlerClick: function () {
        this.showGallary = true
      },
      handleGallaryClick: function () {
        this.showGallary = false
      }
    }
  }
</script>

<style scoped lang="stylus">
  .banner
    overflow hidden
    height 0
    padding-bottom 55%
    position relative

    .banner-img
      width 100%

    .banner-info
      display flex
      position absolute
      left 0
      right 0
      bottom 0
      line-height .6rem
      color #ffffff

      .banner-title
        flex 1
        font-size .32rem
        padding 0 .2rem

      .banner-number
        margin-top .14rem
        padding 0 .2rem
        line-height .4rem
        height .32rem
        font-size .24rem
        border-radius .2rem
        background rgba(0, 0, 0, 8)
</style>
